package factory.simplefacotry;

public class StaticFactory {
	public static final int TYPE_APPLE = 1;
	public static final int TYPE_ORANGE = 2;
	public static final int TYPE_BANANA = 3;

	public static Fruit getFruit(int type) {
		switch (type) {
			case TYPE_APPLE:
				return getFruitApple();
			case TYPE_BANANA:
				return getFruitBanana();
			case TYPE_ORANGE:
				return getFruitOrange();
			default:
				System.out.println("unknow fruit.");
				return null;
		}
	}

	public static Fruit getFruitApple() {
		return new Apple();
	}

	public static Fruit getFruitOrange() {
		return new Orange();
	}

	public static Fruit getFruitBanana() {
		return new Banana();
	}

}
